package com.example.basicquestions.questions.字符串拼接;

import java.util.*;

/**
 * @author liw
 * @date 2023-03-11
 */
public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String[] papers = scanner.nextLine().split(" ");
        String[] letters = scanner.nextLine().split(" ");
        boolean flag = true;
        outer:for(String letter : letters){

            inner:for(int i = 0; i <papers.length; i++){
                String paper_tmp = papers[i];
                if(letter.length() == paper_tmp.length() && handle(letter,paper_tmp)){
                    letters[i] = " ";
                    continue outer;
                }else{
                    flag = false;
                    break outer;
                }
            }
        }
        System.out.println(flag);
    }

    public static boolean handle(String str1 ,String str2){
        char[] chars1 = str1.toCharArray();
        char[] chars2 = str2.toCharArray();
        Arrays.sort(chars1);
        Arrays.sort(chars2);

        return Arrays.equals(chars1,chars2);
    }
}
